<ng-template #drawerTemplate>
  <div
    class="apes-drawer"
    [class.apes-drawer-open]="isOpen"
    [class.apes-drawer-top]="apesPlacement === 'top'"
    [class.apes-drawer-bottom]="apesPlacement === 'bottom'"
    [class.apes-drawer-right]="apesPlacement === 'right'"
    [class.apes-drawer-left]="apesPlacement === 'left'">
    <div  class="apes-drawer-mask" (click)="maskClick($event)" *ngIf="apesMask" [style.zIndex]="apesZIndex" [ngStyle]="apesMaskStyle"></div>
    <div class="apes-drawer-content-wrapper {{ apesWrapClassName }}"
         [style.zIndex]="apesZIndex"
         [style.width]="width"
         [style.height]="height"
         [style.transform]="transform">
      <div class="apes-drawer-content">
        <div class="apes-drawer-wrapper-body"
             [style.overflow]="isLeftOrRight ? 'auto' : null"
             [style.height]="isLeftOrRight ? '100%' : null">
          <div *ngIf="apesTitle" class="apes-drawer-header">
            <div class="apes-drawer-title">
              <ng-container [ngSwitch]="true">
                <ng-container *ngSwitchCase="isTemplateRef(apesTitle)" [ngTemplateOutlet]="apesTitle"></ng-container>
                <ng-container *ngSwitchCase="isNonEmptyString(apesTitle)"><div [innerHTML]="apesTitle"></div></ng-container>
              </ng-container>
            </div>
          </div>
          <button *ngIf="apesClosable" (click)="closeClick()" aria-label="Close" class="apes-drawer-close">
            <span class="apes-drawer-close-x"><i apes-icon [apesType]="'close'"></i></span>
          </button>
          <div class="apes-drawer-body" [ngStyle]="apesBodyStyle" [ngClass]="apesBodyClass">
            <ng-template cdkPortalOutlet></ng-template>
            <ng-container *ngIf="isTemplateRef(apesContent)">
              <ng-container *ngTemplateOutlet="apesContent; context: templateContext"></ng-container>
            </ng-container>
            <ng-content *ngIf="!apesContent"></ng-content>
          </div>
        </div>
      </div>
    </div>
  </div>
</ng-template>
